const data = `
"205-广东省分公司","0,1,2,3,5,6,7,8,10,12,13"
"205-广州","0,1,2,3,5,6,7,8,10,12,13"
"205-深圳","0,1,2,3,5,6,7,8,10,12,13"
"205-东莞","0,1,2,3,5,6,7,8,10,12,13"
"205-佛山","0,1,2,3,5,6,7,8,10,12,13"
"205-中山","0,1,2,3,5,6,7,8,10,12,13"
"205-珠海","0,1,2,3,5,6,7,8,10,12,13"
"205-江门","0,1,2,3,5,6,7,8,10,12,13"
"205-肇庆","0,1,2,3,5,6,7,8,10,12,13"
"205-惠州","0,1,2,3,5,6,7,8,10,12,13"
"205-汕头","0,1,2,3,5,6,7,8,10,12,13"
"205-潮州","0,1,2,3,5,6,7,8,10,12,13"
"205-揭阳","0,1,2,3,5,6,7,8,10,12,13"
"205-汕尾","0,1,2,3,5,6,7,8,10,12,13"
"205-湛江","0,1,2,3,5,6,7,8,10,12,13"
"205-茂名","0,1,2,3,5,6,7,8,10,12,13"
"205-阳江","0,1,2,3,5,6,7,8,10,12,13"
"205-云浮","0,1,2,3,5,6,7,8,10,12,13"
"205-韶关","0,1,2,3,5,6,7,8,10,12,13"
"205-清远","0,1,2,3,5,6,7,8,10,12,13"
"205-梅州","0,1,2,3,5,6,7,8,10,12,13"
"205-河源","0,1,2,3,5,6,7,8,10,12,13"
"206-广东省分公司","0,1,2,3,5,6,7,8,10,12,13"
"206-广州","0,1,2,3,5,6,7,8,10,12,13"
"206-深圳","0,1,2,3,5,6,7,8,10,12,13"
"206-东莞","0,1,2,3,5,6,7,8,10,12,13"
"206-佛山","0,1,2,3,5,6,7,8,10,12,13"
"206-中山","0,1,2,3,5,6,7,8,10,12,13"
"206-珠海","0,1,2,3,5,6,7,8,10,12,13"
"206-江门","0,1,2,3,5,6,7,8,10,12,13"
"206-肇庆","0,1,2,3,5,6,7,8,10,12,13"
"206-惠州","0,1,2,3,5,6,7,8,10,12,13"
"206-汕头","0,1,2,3,5,6,7,8,10,12,13"
"206-潮州","0,1,2,3,5,6,7,8,10,12,13"
"206-揭阳","0,1,2,3,5,6,7,8,10,12,13"
"206-汕尾","0,1,2,3,5,6,7,8,10,12,13"
"206-湛江","0,1,2,3,5,6,7,8,10,12,13"
"206-茂名","0,1,2,3,5,6,7,8,10,12,13"
"206-阳江","0,1,2,3,5,6,7,8,10,12,13"
"206-云浮","0,1,2,3,5,6,7,8,10,12,13"
"206-韶关","0,1,2,3,5,6,7,8,10,12,13"
"206-清远","0,1,2,3,5,6,7,8,10,12,13"
"206-梅州","0,1,2,3,5,6,7,8,10,12,13"
"206-河源","0,1,2,3,5,6,7,8,10,12,13"
"207-广东省分公司","0,1,2,3,5,6,7,8,10,12,13"
"207-广州","0,1,2,3,5,6,7,8,10,12,13"
"207-深圳","0,1,2,3,5,6,7,8,10,12,13"
"207-东莞","0,1,2,3,5,6,7,8,10,12,13"
"207-佛山","0,1,2,3,5,6,7,8,10,12,13"
"207-中山","0,1,2,3,5,6,7,8,10,12,13"
"207-珠海","0,1,2,3,5,6,7,8,10,12,13"
"207-江门","0,1,2,3,5,6,7,8,10,12,13"
"207-肇庆","0,1,2,3,5,6,7,8,10,12,13"
"207-惠州","0,1,2,3,5,6,7,8,10,12,13"
"207-汕头","0,1,2,3,5,6,7,8,10,12,13"
"207-潮州","0,1,2,3,5,6,7,8,10,12,13"
"207-揭阳","0,1,2,3,5,6,7,8,10,12,13"
"207-汕尾","0,1,2,3,5,6,7,8,10,12,13"
"207-湛江","0,1,2,3,5,6,7,8,10,12,13"
"207-茂名","0,1,2,3,5,6,7,8,10,12,13"
"207-阳江","0,1,2,3,5,6,7,8,10,12,13"
"207-云浮","0,1,2,3,5,6,7,8,10,12,13"
"207-韶关","0,1,2,3,5,6,7,8,10,12,13"
"207-清远","0,1,2,3,5,6,7,8,10,12,13"
"207-梅州","0,1,2,3,5,6,7,8,10,12,13"
"207-河源","0,1,2,3,5,6,7,8,10,12,13"
"208-广东省分公司","0,1,2,3,5,6,7,8,10,12,13"
"208-广州","0,1,2,3,5,6,7,8,10,12,13"
"208-深圳","0,1,2,3,5,6,7,8,10,12,13"
"208-东莞","0,1,2,3,5,6,7,8,10,12,13"
"208-佛山","0,1,2,3,5,6,7,8,10,12,13"
"208-中山","0,1,2,3,5,6,7,8,10,12,13"
"208-珠海","0,1,2,3,5,6,7,8,10,12,13"
"208-江门","0,1,2,3,5,6,7,8,10,12,13"
"208-肇庆","0,1,2,3,5,6,7,8,10,12,13"
"208-惠州","0,1,2,3,5,6,7,8,10,12,13"
"208-汕头","0,1,2,3,5,6,7,8,10,12,13"
"208-潮州","0,1,2,3,5,6,7,8,10,12,13"
"208-揭阳","0,1,2,3,5,6,7,8,10,12,13"
"208-汕尾","0,1,2,3,5,6,7,8,10,12,13"
"208-湛江","0,1,2,3,5,6,7,8,10,12,13"
"208-茂名","0,1,2,3,5,6,7,8,10,12,13"
"208-阳江","0,1,2,3,5,6,7,8,10,12,13"
"208-云浮","0,1,2,3,5,6,7,8,10,12,13"
"208-韶关","0,1,2,3,5,6,7,8,10,12,13"
"208-清远","0,1,2,3,5,6,7,8,10,12,13"
"208-梅州","0,1,2,3,5,6,7,8,10,12,13"
"208-河源","0,1,2,3,5,6,7,8,10,12,13"
"209-广东省分公司","0,1,2,3,5,6,7,8,10,12,13"
"209-广州","0,1,2,3,5,6,7,8,10,12,13"
"209-深圳","0,1,2,3,5,6,7,8,10,12,13"
"209-东莞","0,1,2,3,5,6,7,8,10,12,13"
"209-佛山","0,1,2,3,5,6,7,8,10,12,13"
"209-中山","0,1,2,3,5,6,7,8,10,12,13"
"209-珠海","0,1,2,3,5,6,7,8,10,12,13"
"209-江门","0,1,2,3,5,6,7,8,10,12,13"
"209-肇庆","0,1,2,3,5,6,7,8,10,12,13"
"209-惠州","0,1,2,3,5,6,7,8,10,12,13"
"209-汕头","0,1,2,3,5,6,7,8,10,12,13"
"209-潮州","0,1,2,3,5,6,7,8,10,12,13"
"209-揭阳","0,1,2,3,5,6,7,8,10,12,13"
"209-汕尾","0,1,2,3,5,6,7,8,10,12,13"
"209-湛江","0,1,2,3,5,6,7,8,10,12,13"
"209-茂名","0,1,2,3,5,6,7,8,10,12,13"
"209-阳江","0,1,2,3,5,6,7,8,10,12,13"
"209-云浮","0,1,2,3,5,6,7,8,10,12,13"
"209-韶关","0,1,2,3,5,6,7,8,10,12,13"
"209-清远","0,1,2,3,5,6,7,8,10,12,13"
"209-梅州","0,1,2,3,5,6,7,8,10,12,13"
"209-河源","0,1,2,3,5,6,7,8,10,12,13"
"210-广东省分公司","0,1,2,3,5,6,7,8,10,12,13"
"210-广州","0,1,2,3,5,6,7,8,10,12,13"
"210-深圳","0,1,2,3,5,6,7,8,10,12,13"
"210-东莞","0,1,2,3,5,6,7,8,10,12,13"
"210-佛山","0,1,2,3,5,6,7,8,10,12,13"
"210-中山","0,1,2,3,5,6,7,8,10,12,13"
"210-珠海","0,1,2,3,5,6,7,8,10,12,13"
"210-江门","0,1,2,3,5,6,7,8,10,12,13"
"210-肇庆","0,1,2,3,5,6,7,8,10,12,13"
"210-惠州","0,1,2,3,5,6,7,8,10,12,13"
"210-汕头","0,1,2,3,5,6,7,8,10,12,13"
"210-潮州","0,1,2,3,5,6,7,8,10,12,13"
"210-揭阳","0,1,2,3,5,6,7,8,10,12,13"
"210-汕尾","0,1,2,3,5,6,7,8,10,12,13"
"210-湛江","0,1,2,3,5,6,7,8,10,12,13"
"210-茂名","0,1,2,3,5,6,7,8,10,12,13"
"210-阳江","0,1,2,3,5,6,7,8,10,12,13"
"210-云浮","0,1,2,3,5,6,7,8,10,12,13"
"210-韶关","0,1,2,3,5,6,7,8,10,12,13"
"210-清远","0,1,2,3,5,6,7,8,10,12,13"
"210-梅州","0,1,2,3,5,6,7,8,10,12,13"
"210-河源","0,1,2,3,5,6,7,8,10,12,13"
"211-广东省分公司","0,1,2,3,5,6,7,8,10,12,13"
"211-广州","0,1,2,3,5,6,7,8,10,12,13"
"211-深圳","0,1,2,3,5,6,7,8,10,12,13"
"211-东莞","0,1,2,3,5,6,7,8,10,12,13"
"211-佛山","0,1,2,3,5,6,7,8,10,12,13"
"211-中山","0,1,2,3,5,6,7,8,10,12,13"
"211-珠海","0,1,2,3,5,6,7,8,10,12,13"
"211-江门","0,1,2,3,5,6,7,8,10,12,13"
"211-肇庆","0,1,2,3,5,6,7,8,10,12,13"
"211-惠州","0,1,2,3,5,6,7,8,10,12,13"
"211-汕头","0,1,2,3,5,6,7,8,10,12,13"
"211-潮州","0,1,2,3,5,6,7,8,10,12,13"
"211-揭阳","0,1,2,3,5,6,7,8,10,12,13"
"211-汕尾","0,1,2,3,5,6,7,8,10,12,13"
"211-湛江","0,1,2,3,5,6,7,8,10,12,13"
"211-茂名","0,1,2,3,5,6,7,8,10,12,13"
"211-阳江","0,1,2,3,5,6,7,8,10,12,13"
"211-云浮","0,1,2,3,5,6,7,8,10,12,13"
"211-韶关","0,1,2,3,5,6,7,8,10,12,13"
"211-清远","0,1,2,3,5,6,7,8,10,12,13"
"211-梅州","0,1,2,3,5,6,7,8,10,12,13"
"211-河源","0,1,2,3,5,6,7,8,10,12,13"
"212-广东省分公司","0,1,2,3,5,6,7,8,10,12,13"
"212-广州","0,1,2,3,5,6,7,8,10,12,13"
"212-深圳","0,1,2,3,5,6,7,8,10,12,13"
"212-东莞","0,1,2,3,5,6,7,8,10,12,13"
"212-佛山","0,1,2,3,5,6,7,8,10,12,13"
"212-中山","0,1,2,3,5,6,7,8,10,12,13"
"212-珠海","0,1,2,3,5,6,7,8,10,12,13"
"212-江门","0,1,2,3,5,6,7,8,10,12,13"
"212-肇庆","0,1,2,3,5,6,7,8,10,12,13"
"212-惠州","0,1,2,3,5,6,7,8,10,12,13"
"212-汕头","0,1,2,3,5,6,7,8,10,12,13"
"212-潮州","0,1,2,3,5,6,7,8,10,12,13"
"212-揭阳","0,1,2,3,5,6,7,8,10,12,13"
"212-汕尾","0,1,2,3,5,6,7,8,10,12,13"
"212-湛江","0,1,2,3,5,6,7,8,10,12,13"
"212-茂名","0,1,2,3,5,6,7,8,10,12,13"
"212-阳江","0,1,2,3,5,6,7,8,10,12,13"
"212-云浮","0,1,2,3,5,6,7,8,10,12,13"
"212-韶关","0,1,2,3,5,6,7,8,10,12,13"
"212-清远","0,1,2,3,5,6,7,8,10,12,13"
"212-梅州","0,1,2,3,5,6,7,8,10,12,13"
"212-河源","0,1,2,3,5,6,7,8,10,12,13"
"301-广东省分公司","0,1,2,3,5,6,7,8,10,12,13"
"301-广州","0,1,2,3,5,6,7,8,10,12,13"
"301-深圳","0,1,2,3,5,6,7,8,10,12,13"
"301-东莞","0,1,2,3,5,6,7,8,10,12,13"
"301-佛山","0,1,2,3,5,6,7,8,10,12,13"
"301-中山","0,1,2,3,5,6,7,8,10,12,13"
"301-珠海","0,1,2,3,5,6,7,8,10,12,13"
"301-江门","0,1,2,3,5,6,7,8,10,12,13"
"301-肇庆","0,1,2,3,5,6,7,8,10,12,13"
"301-惠州","0,1,2,3,5,6,7,8,10,12,13"
"301-汕头","0,1,2,3,5,6,7,8,10,12,13"
"301-潮州","0,1,2,3,5,6,7,8,10,12,13"
"301-揭阳","0,1,2,3,5,6,7,8,10,12,13"
"301-汕尾","0,1,2,3,5,6,7,8,10,12,13"
"301-湛江","0,1,2,3,5,6,7,8,10,12,13"
"301-茂名","0,1,2,3,5,6,7,8,10,12,13"
"301-阳江","0,1,2,3,5,6,7,8,10,12,13"
"301-云浮","0,1,2,3,5,6,7,8,10,12,13"
"301-韶关","0,1,2,3,5,6,7,8,10,12,13"
"301-清远","0,1,2,3,5,6,7,8,10,12,13"
"301-梅州","0,1,2,3,5,6,7,8,10,12,13"
"301-河源","0,1,2,3,5,6,7,8,10,12,13"
`
const name = [
    '在线率趋势', '不在线原因',
    '在册在线分析', '活跃度趋势',
    '在线构成 ', '平均年龄',
    '年龄分布', '学历分布',
    '不在线人员趋势', '作业透视',
    '关键指标趋势', '岗位人员效率排行',
    '人均积分趋势', '作业透视',
    '作业透视'
]
// const sort = `
// 广东省分公司
// 广州
// 深圳
// 东莞
// 佛山
// 中山
// 珠海
// 江门
// 肇庆
// 惠州
// 汕头
// 潮州
// 揭阳
// 汕尾
// 湛江
// 茂名
// 阳江
// 云浮
// 韶关
// 清远
// 梅州
// 河源
// `.split('\n').filter(Boolean).reduce((res, name, idx) => (res[name] = idx, res), {})
// const dateGroup = {}
// const res = data.split('\n').filter(Boolean).map(it => {
//     const item = it.slice(1, -1).split('","')
//     const [date, province] = item[0].split('-')
//     console.log(province, sort[province])
//     dateGroup[date] = dateGroup[date] || []
//     item[1] = item[1].split(',').map(code => name[code]).join(',')
//     if (sort[province] === undefined) return
//     dateGroup[date][sort[province]] = `"${item.join(`","`)}"`
// })
const res = data.split('\n').filter(Boolean).map(it => {
    const item = it.slice(1, -1).split('","')
    // const [date, province] = item[0].split('-')
    // console.log(province, sort[province])
    // dateGroup[date] = dateGroup[date] || []
    item[1] = item[1].split(',').map(code => name[code]).join(',')
    return `"${item.join(`","`)}"`
})
const fs = require('fs')
fs.writeFileSync('./线.log.csv',
        `${res.join('\n')}\n`,
        { flag: 'a' })
// Object.values(dateGroup).forEach(group => {
//     fs.writeFileSync('./endata.log.csv',
//         `${group.join('\n')}\n`,
//         { flag: 'a' })
// })